package com.yonyou.ucf.mdf.app.isvdxq.firstpart.location.mapper;

import com.yonyou.ucf.mdf.app.isvdxq.firstpart.location.entity.OrderStoreDetailEntity;
import org.apache.ibatis.jdbc.SQL;

public class OrderStoreDetailSqlProvider {

    public String insertSelective(OrderStoreDetailEntity record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("dxq_orderstoredetail");

        if (record.getId() != null) {
            sql.VALUES("`id`", "#{id,jdbcType=INTEGER}");
        }

        if (record.getStoreid() != null) {
            sql.VALUES("`storeid`", "#{storeid,jdbcType=VARCHAR}");
        }
        if (record.getMainid() != null) {
            sql.VALUES("`mainid`", "#{mainid,jdbcType=VARCHAR}");
        }
        if (record.getDetailid() != null) {
            sql.VALUES("`detailid`", "#{detailid,jdbcType=VARCHAR}");
        }
        if (record.getInventoryowner() != null) {
            sql.VALUES("`inventoryowner`", "#{inventoryowner,jdbcType=VARCHAR}");
        }
        if (record.getReserveid() != null) {
            sql.VALUES("`reserveid`", "#{reserveid,jdbcType=VARCHAR}");
        }

        if (record.getOrderid() != null) {
            sql.VALUES("`orderid`", "#{orderid,jdbcType=VARCHAR}");
        }

        if (record.getOrderdetailid() != null) {
            sql.VALUES("`orderdetailid`", "#{orderdetailid,jdbcType=VARCHAR}");
        }

        if (record.getSourceid() != null) {
            sql.VALUES("`sourceid`", "#{sourceid,jdbcType=VARCHAR}");
        }
        if (record.getSourceautoid() != null) {
            sql.VALUES("`sourceautoid`", "#{sourceautoid,jdbcType=VARCHAR}");
        }

        if (record.getSourcecode() != null) {
            sql.VALUES("`sourcecode`", "#{sourcecode,jdbcType=VARCHAR}");
        }

        if (record.getFirstsourceid() != null) {
            sql.VALUES("`firstsourceid`", "#{firstsourceid,jdbcType=VARCHAR}");
        }
        if (record.getFirstsourceautoid() != null) {
            sql.VALUES("`firstsourceautoid`", "#{firstsourceautoid,jdbcType=VARCHAR}");
        }

        if (record.getFirstsourcecode() != null) {
            sql.VALUES("`firstsourcecode`", "#{firstsourcecode,jdbcType=VARCHAR}");
        }

        if (record.getUnitid() != null) {
            sql.VALUES("`unitid`", "#{unitid,jdbcType=VARCHAR}");
        }

        if (record.getStockunitid() != null) {
            sql.VALUES("`stockunitid`", "#{stockunitid,jdbcType=VARCHAR}");
        }

        if (record.getProductid() != null) {
            sql.VALUES("`productid`", "#{productid,jdbcType=VARCHAR}");
        }

        if (record.getProductskuid() != null) {
            sql.VALUES("`productskuid`", "#{productskuid,jdbcType=VARCHAR}");
        }

        if (record.getWarehouseid() != null) {
            sql.VALUES("`warehouseid`", "#{warehouseid,jdbcType=VARCHAR}");
        }

        if (record.getOperateuserid() != null) {
            sql.VALUES("`operateuserid`", "#{operateuserid,jdbcType=VARCHAR}");
        }

        if (record.getOperatetime() != null) {
            sql.VALUES("`operatetime`", "#{operatetime,jdbcType=VARCHAR}");
        }

        if (record.getOperatetype() != null) {
            sql.VALUES("`operatetype`", "#{operatetype,jdbcType=VARCHAR}");
        }

        if (record.getOperatetypename() != null) {
            sql.VALUES("`operatetypename`", "#{operatetypename,jdbcType=VARCHAR}");
        }

        if (record.getStorecount() > 0) {
            sql.VALUES("`storecount`", "#{storecount,jdbcType=DECIMAL}");
        }
        if (record.getEpccount() != null) {
            sql.VALUES("`epccount`", "#{epccount,jdbcType=INTEGER}");
        }

        if (record.getDr() != null) {
            sql.VALUES("`dr`", "#{dr,jdbcType=SMALLINT}");
        }

        return sql.toString();
    }

    public String updateByPrimaryKeySelective(OrderStoreDetailEntity record) {
        SQL sql = new SQL();
        sql.UPDATE("dxq_orderstoredetail");

        if (record.getStoreid() != null) {
            sql.SET("`storeid` = #{storeid,jdbcType=VARCHAR}");
        }
        if (record.getMainid() != null) {
            sql.SET("`mainid` = #{mainid,jdbcType=VARCHAR}");
        }
        if (record.getDetailid() != null) {
            sql.SET("`detailid` = #{detailid,jdbcType=VARCHAR}");
        }
        if (record.getInventoryowner() != null) {
            sql.SET("`inventoryowner` = #{inventoryowner,jdbcType=VARCHAR}");
        }
        if (record.getReserveid() != null) {
            sql.SET("`reserveid` = #{reserveid,jdbcType=VARCHAR}");
        }

        if (record.getOrderid() != null) {
            sql.SET("`orderid` = #{orderid,jdbcType=VARCHAR}");
        }

        if (record.getOrderdetailid() != null) {
            sql.SET("`orderdetailid` = #{orderdetailid,jdbcType=VARCHAR}");
        }

        if (record.getSourceid() != null) {
            sql.SET("`sourceid` = #{sourceid,jdbcType=VARCHAR}");
        }
        if (record.getSourceautoid() != null) {
            sql.SET("`sourceautoid` = #{sourceautoid,jdbcType=VARCHAR}");
        }

        if (record.getSourcecode() != null) {
            sql.SET("`sourcecode` = #{sourcecode,jdbcType=VARCHAR}");
        }

        if (record.getFirstsourceid() != null) {
            sql.SET("`firstsourceid` = #{firstsourceid,jdbcType=VARCHAR}");
        }

        if (record.getFirstsourceautoid() != null) {
            sql.SET("`firstsourceautoid` = #{firstsourceautoid,jdbcType=VARCHAR}");
        }

        if (record.getFirstsourcecode() != null) {
            sql.SET("`firstsourcecode` = #{firstsourcecode,jdbcType=VARCHAR}");
        }

        if (record.getUnitid() != null) {
            sql.SET("`unitid` = #{unitid,jdbcType=VARCHAR}");
        }

        if (record.getStockunitid() != null) {
            sql.SET("`stockunitid` = #{stockunitid,jdbcType=VARCHAR}");
        }

        if (record.getProductid() != null) {
            sql.SET("`productid` = #{productid,jdbcType=VARCHAR}");
        }

        if (record.getProductskuid() != null) {
            sql.SET("`productskuid` = #{productskuid,jdbcType=VARCHAR}");
        }

        if (record.getWarehouseid() != null) {
            sql.SET("`warehouseid` = #{warehouseid,jdbcType=VARCHAR}");
        }

        if (record.getOperateuserid() != null) {
            sql.SET("`operateuserid` = #{operateuserid,jdbcType=VARCHAR}");
        }

        if (record.getOperatetime() != null) {
            sql.SET("`operatetime` = #{operatetime,jdbcType=VARCHAR}");
        }

        if (record.getOperatetype() != null) {
            sql.SET("`operatetype` = #{operatetype,jdbcType=VARCHAR}");
        }

        if (record.getOperatetypename() != null) {
            sql.SET("`operatetypename` = #{operatetypename,jdbcType=VARCHAR}");
        }

        if (record.getStorecount() > 0) {
            sql.SET("`storecount` = #{storecount,jdbcType=DECIMAL}");
        }
        if (record.getEpccount() != null) {
            sql.SET("`epccount` = #{epccount,jdbcType=INTEGER}");
        }

        if (record.getDr() != null) {
            sql.SET("`dr` = #{dr,jdbcType=SMALLINT}");
        }

        sql.WHERE("`id` = #{id,jdbcType=INTEGER}");

        return sql.toString();
    }
}